﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EZCRS.HCMS.Data;
using EZCRS.HCMS.Entity;
using System.Data;
using System.Data.SqlClient;

namespace EZCRS.HCMS.SqlClient
{
    public class sql_hcrs_season
    {

        public List<HCRS_Season> getallitem(int Pid)
        {
            string sqlstr = "select * from HCRS_Season WHERE Property_ID = " + Pid.ToString();

            return ExecSql.GetTableList<HCRS_Season>(sqlstr);
        }


        public List<HCRS_Season> getListByPage(int Page, int PageSize, string strwhere, out int RowCount)
        {

            int recordcount = 0;

            //RowCount = 1;

            List<HCRS_Season> _log = ExecSql.GetTableList<HCRS_Season>("HCRS_Season", "*", " id desc ", "id", PageSize, Page, strwhere, out recordcount);

            RowCount = recordcount;

            //pagecount = CFun.pagecount(recordcount, PageSize);

            return _log;
        }


        public HCRS_Season getitem(int ID)
        {
            try
            {
                return ExecSql.GetTableList<HCRS_Season>("select * from HCRS_Season where ID=" + ID.ToString())[0];
            }
            catch { return null; }
        }

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public bool deleteitem(int ID)
        {
            int i = ExecSql.SqlExecNoquery("DELETE FROM HCRS_Season WHERE ID = " + ID.ToString());

            if (i > 0)
                return true;

            return false;
        }

        public bool insertorupdate(HCRS_Season _aircode)
        {
            return ExecSql.InsertOrUpdateData<HCRS_Season>(_aircode);
        }

    }
}
